package com.aubrey.threadDemo.lock;

public class MyReentrantLockDemo {
	MyReetrantLock myReetrantLock = new MyReetrantLock();
	
	public static void main(String[] args) {
		MyReentrantLockDemo m = new MyReentrantLockDemo();
		m.print();
	}
	
	public void print() {
		System.out.println("进入print");
		myReetrantLock.lock();
		System.out.println("print获取锁");
		this.count();
		myReetrantLock.unLock();
		System.out.println("print释放锁，方法结束");
	}
	
	public void count() {
		System.out.println("进入count");
		myReetrantLock.lock();
		System.out.println("count获取锁");
		System.out.println("do........");
		myReetrantLock.unLock();
		System.out.println("count释放锁，方法结束");
	}


}
